package main

import (
	"log"
	"os"
)

var fileName = "log.log"
var logFile *os.File
var logger *log.Logger

func init() {
	logFile, err = os.OpenFile(fileName, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
	if err != nil {
		log.Fatalln("open file error !")
	}
	// 创建一个日志对象
	logger = log.New(logFile, "", log.LstdFlags)
	//配置log的Flag参数
	logger.SetFlags(logger.Flags() | log.LstdFlags)
}

func Println(v ...interface{}) {
	logger.Println(v...)
	log.Println(v...)
}
